


function locAddActTo(iActivityType, sContentId)
{
var sParentId   = null;
var sParentType = null;
var sPartyId   = null;
var sPartyType = null;
var sPartyName = null;
var sPartyLocation = null;


sParentId   = crmFormSubmit.crmFormSubmitId.value;
sParentType = crmFormSubmit.crmFormSubmitObjectType.value;


if (iActivityType != Task)
{
var customerId = crmForm.all.customerid.DataValue;
if (!IsNull(customerId))
{
if (!IsNull(customerId[0]))
{
sPartyId   = customerId[0].id;
sPartyType = customerId[0].type;
}
}
sPartyName = crmForm.customerid.parentElement.previousSibling.innerText;

sPartyLocation = "";
}


addActivityTo(iActivityType
, sParentId
, sParentType
, _sParentName
, sPartyId
, sPartyType
, sPartyName
, sPartyLocation
, sContentId);
}

function resolve()
{
var url = "dlg_closecase.aspx";
url += "?pId=" + CrmEncodeDecode.CrmUrlEncode(crmFormSubmit.crmFormSubmitId.value);
url += "&pType=" + CrmEncodeDecode.CrmUrlEncode(crmFormSubmit.crmFormSubmitObjectType.value);

var ret_val = openStdDlg(url, document, 400, 365);

if (ret_val)
{

crmForm.name.defaultValue = "";
var oActivityXml = createHiddenInput("crActivityXml", ret_val.ActivityXml);
var oStatusCode  = createHiddenInput("crNewStatus",   ret_val.StatusCode);

if (!crmForm.SubmitCrmForm(FormEventId_Deactivate, true, true, false))
{


deleteInput(oActivityXml);
deleteInput(oStatusCode);
}
}
}

function reactivate(obj_type)
{
var ret_val = openStdDlg("dlg_reactivate.aspx", null, 400, 200);
if (ret_val)
{


crmForm.SubmitCrmForm(FormEventId_Reactivate, true, true, false);
}
}

function cancel()
{
var ret_val = openStdDlg("dlg_cancel.aspx", null, 400, 200);
if (ret_val)
{


crmForm.SubmitCrmForm(FormEventId_IncidentCancel, true, true, false);
}
}
